package com.xpffly.design.factory.base;

import com.xpffly.design.factory.base.factory.AbstractHumanFactory;
import com.xpffly.design.factory.base.factory.HumanFactory;
import com.xpffly.design.factory.base.service.Human;
import com.xpffly.design.factory.base.service.impl.BlackHuman;
import com.xpffly.design.factory.base.service.impl.WhiteHuman;
import com.xpffly.design.factory.base.service.impl.YellowHuman;

/**
 * @Author: xpengfei
 * @Date: 2021/3/26 22:53
 * @Description： 女娲类，创造人类
 */
public class NvWa {
    public static void main(String[] args) {
        // 声明八卦炉
        AbstractHumanFactory humanFactory = new HumanFactory();
        // 创造白人
        System.out.println("----创造白色人种----");
        Human whiteHuman = humanFactory.createHuman(WhiteHuman.class);
        whiteHuman.getColor();
        whiteHuman.talk();
        System.out.println("----------------------------------------------");
        // 创造黑人
        System.out.println("----创造黑色人种----");
        Human blackHuman = humanFactory.createHuman(BlackHuman.class);
        blackHuman.getColor();
        blackHuman.talk();
        System.out.println("----------------------------------------------");
        // 创造黄人
        System.out.println("----创造黄色人种----");
        Human yellowHuman = humanFactory.createHuman(YellowHuman.class);
        yellowHuman.getColor();
        yellowHuman.talk();
        System.out.println("----------------------------------------------");
    }
}
